<?php

namespace app\admin\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class ReasonTest extends CommonTest
{

    //再命令窗口中执行“php think interface-ReasonTest”
    protected function configure()
    {
        $this->setName('interface-ReasonTest')
            ->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        //Route::any('admin/reason/create', 'admin/reason/toAddReason');                                                          // 添加理由
        $data = Tools::curl($this->url . "admin/reason/create", json_encode(["token" => "$this->token", "content" => "xxx"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('admin/reason/getPageList', 'admin/reason/getReasonList');                                                   // 理由列表，分页功能
        $data = Tools::curl($this->url . "admin/reason/getPageList", json_encode(["token" => "$this->token"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('admin/reason/getDetailsById', 'admin/reason/getReasonDetail');                                              // 理由的详细信息
        $data = Tools::curl($this->url . "admin/reason/getDetailsById", json_encode(["token" => "$this->token", "id" => 1]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

    }
}
